const { existsSync, constants } = require('fs')
const { resolve } = require('path')
const intConfig = require('../template/config-tp.js')

const getConfig = ()=>{
	const extConfigPath = resolve(process.cwd(), './moxcss.config.js')
	let isfile = existsSync(extConfigPath, constants.F_OK)

	if (isfile) {
		let extConfig = require(extConfigPath)
		extConfig.input = extConfig.input.map(i=>resolve(extConfig.rootDir,i))
		extConfig.output = resolve(extConfig.rootDir, extConfig.output)
		return { ...intConfig, ...extConfig }
	} else{
		return intConfig
	}
	
}

module.exports = getConfig